msg = {}
am2301 = {}
am2301["temp"] = 32.1
am2301["humi"] = 88.6
msg["divice_name"] = "device_test"
msg["divice_num"] = 1
msg["device_addr"] = 1
msg["data_val"] = am2301

ok,json = pcall(cjson.encode, msg)
if ok then
    print(json)
else
    print("failed to encode json")
end

if test==nil then
    print("test = nil")
    test = 1
else
    test = test + 1
    print("test=%d"..test)
end